<!--
* description: 服务活动查询-备件
* author: wangjuan
* createdDate: 2021-3-11
-->
<template>
  <div class="app-container app-container-table">
    <one-table-template
      ref="multipleTable"
      :key="oneTableKey"
      :dynamic-table-cols="tableCols"
      :dynamic-form-fields="formField"
      :dynamic-is-show-more-btn="true"
      :dynamic-is-show-select="false"
      :dynamic-is-init-table="true"
      :dynamic-table-defult-height="tableHeight"
      :is-show-pagination="false"
    />
  </div>
</template>
<script>

import { oneTableWithViewTemplateMixins } from '@/components/mixins/oneTableWithViewTemplateMixins'
import OneTableTemplate from '@/components/templates/oneTable'
import Vue from 'vue'

export default {
  name: 'Accessories',

  components: {
    OneTableTemplate
  },
  // 组件混入对象
  mixins: [oneTableWithViewTemplateMixins],

  props: {

  },

  // 阻塞路由预加载网格中组件的数据
  beforeRouteEnter(to, from, next) {
    Vue.prototype.$ConfigCache.CacheConfig.initData([to.path, ''], function() {
      next()
    })
  },

  data() {
    // 页面标识（与上面beforeRouteEnter中的对应）
    const viewPageCode = this.$route.path
    // 绑定事件配置化事件
    this.$ConfigCache.CacheConfig.bindEvent(this, [viewPageCode])

    return {
      tableHeight: 400,

      // 动态生成网格列
      tableCols:
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path] &&
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path].tableCols &&
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path].tableCols
          .length > 0
          ? this.$ConfigCache.CacheConfig.cacheData[this.$route.path].tableCols
          : [
            {
              prop: 'releaseId',
              label: '主键ID',
              hidden: true,
              alwaysHidden: true
            },
            {
              prop: 'repairOtherCode',
              label: '并发控制ID',
              hidden: true,
              alwaysHidden: true
            },
            {
              prop: 'repairOtherName',
              label: '其他项目名称'
            },
            {
              prop: 'otherTotalFee',
              label: '费用合计'
            }
          ],

      // 表单查询数据
      formField: this.$utils.getFormField(this, {

      }, this.$ConfigCache.CacheConfig.cacheData[viewPageCode])
    }
  },

  watch: {

  },

  mounted() {
    // 列表查询
    this.queryTable(1)
  }
}
</script>
<style lang="scss" scoped>
/deep/.el-input-number--small {
  width: 160px;
}
/deep/.el-input-number--small .el-input__inner {
  padding-right: 0;
}
/deep/.el-input-number .el-input__inner {
  padding-left: 0;
}
/deep/.el-table .el-input--small .el-input__inner {
  height: 26px;
}
</style>
